module ChangeHelper
  #随机图片
  def get_resource_rand(resource,type)
    #得到的图片的数组
    src_arry = Array.new
    return_arry = Array.new
    pic_path = File.join($upload_path,resource.res_dir,type)
    src_arry = DataFile.traverse_dir(pic_path, src_arry)
    src_arry.each  do |str|
      return_arry.push str.gsub($upload_path, $img_path)
    end    
    @view_img_path = return_arry[0]
  end
end
